-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JS errors to r #123
Open
federiva
wants to merge
6
commits into
dev
Choose a base branch
from
105.js-errors-to-R
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
JS errors to r #123
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## dev #123 +/- ##
=========================================
- Coverage 11.72% 8.96% -2.77%
=========================================
Files 13 13
Lines 162 212 +50
=========================================
Hits 19 19
- Misses 143 193 +50
|
Also adding an example app with shiny modules library(shiny)
library(shiny.gosling)
areachart_ui <- function(id) {
ns <- NS(id)
fluidRow(
column(
width = 8,
goslingOutput(ns("gosling_plot_test"))
),
column(
width = 4,
fluidRow(
column(
2,
actionButton(
ns("download_png"),
"PNG",
icon = icon("cloud-arrow-down")
)
),
column(
2,
actionButton(
ns("download_pdf"),
"PDF",
icon = icon("cloud-arrow-down")
)
)
)
)
)
}
areachart_server <- function(id) {
# Create data object ----
view1_data <- track_data(
url = "https://resgen.io/api/v1/tileset_info/?d=UvVPeLHuRDiYA3qwFlm7xQ",
type = "multivec",
row = "sample",
column = "position",
value = "peak",
categories = list("sample 1")
)
# Create visual channels ----
view1_x <- visual_channel_x(
field = "position", type = "genomic", axis = "bottom"
)
view1_y <- visual_channel_x(
field = "peak", type = "quantitative", axis = "right"
)
# Create single track ----
single_track <- add_single_track(
width = 800,
height = 180,
data = view1_data,
mark = "area",
x = view1_x,
y = view1_y,
size = visual_channel_size(
value = 2
)
)
# Compose the track ----
single_composed_view <- compose_view(
tracks = single_track,
layout = "linear"
)
# Arrange the view above ----
single_composed_views <- arrange_views(
title = "Basic Marks: Area",
subtitle = "This is a simple Area Chart",
views = single_composed_view
)
moduleServer(id, function(input, output, session) {
observeEvent(input$download_png, {
export_png(component_id = "sars_cov2")
})
observeEvent(input$download_pdf, {
export_pdf(component_id = "sars_cov2")
})
observeEvent(input$zoom_out, {
zoom_to_extent(
component_id = "sars_cov2",
view_id = "view2_track1"
)
})
output$gosling_plot_test <- renderGosling({
gosling(
component_id = "sars_cov2",
single_composed_views,
clean_braces = TRUE
)
})
})
}
barchart_ui <- function(id) {
ns <- NS(id)
fluidRow(
column(
width = 8,
goslingOutput(ns("gosling_plot_test"))
),
column(
width = 4,
fluidRow(
column(
2,
actionButton(
ns("download_png"),
"PNG",
icon = icon("cloud-arrow-down")
)
),
column(
2,
actionButton(
ns("download_pdf"),
"PDF",
icon = icon("cloud-arrow-down")
)
)
)
)
)
}
barchart_server <- function(id) {
# Create data object ----
view1_data <- track_data(
url = "https://resgen.io/api/v1/tileset_info/?d=UvVPeLHuRDiYA3qwFlm7xQ",
type = "multivec",
row = "sample",
column = "position",
value = "peak",
categories = list("sample 1"),
binSize = 5
)
# Create visual channels ----
view1_x <- visual_channel_x(
field = "start", type = "genomic", axis = "bottom"
)
view1_xe <- visual_channel_x(
field = "end", type = "genomic",
)
view1_y <- visual_channel_y(
field = "peak", type = "quantitative", axis = "right"
)
# Create single track ----
single_track <- add_single_track(
width = 800,
height = 180,
data = view1_data,
mark = "bar",
x = view1_x,
xe = view1_xe,
y = view1_y,
size = visual_channel_size(
value = 5
)
)
# Compose the track ----
single_composed_view <- compose_view(
tracks = single_track,
layout = "linear"
)
# Arrange the view above ----
single_composed_views <- arrange_views(
title = "Basic Marks: bar",
subtitle = "This is a simple bar chart.",
views = single_composed_view
)
moduleServer(id, function(input, output, session) {
observeEvent(input$download_png, {
export_png(component_id = "sars_cov2")
})
observeEvent(input$download_pdf, {
export_pdf(component_id = "sars_cov2")
})
observeEvent(input$zoom_out, {
zoom_to_extent(
component_id = "sars_cov2",
view_id = "view2_track1"
)
})
output$gosling_plot_test <- renderGosling({
gosling(
component_id = "sars_cov2",
single_composed_views,
clean_braces = TRUE
)
})
})
}
ui <- navbarPage(
title = "shiny.gosling",
use_gosling(),
tabPanel(
"Area",
fluidPage(
width = 12,
areachart_ui("areachart")
)
),
tabPanel(
"Barchart",
fluidPage(
width = 12,
barchart_ui("barchart")
)
)
)
server <- function(input, output, session) {
areachart_server("areachart")
barchart_server("barchart")
}
shinyApp(ui, server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #105
Changes description
Steps to reproduce
Right now we are loading the library from a cdn. In order to test this PR before updating the file used in the CDN please do the following
inst/www
foldergoslingDependency
function incomponents.R
and replace it with the following in order to use a local version of itdevtools::load_all()